{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=92
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var	
	n,cc:longint;
	a:array[0..50] of longint;
 
procedure put();
 
var
	i:longint;
 
begin
for i := 1 to cc do
	write(a[i], ' ');
writeln;
end;
 
procedure go(k,p:longint);
 
var
	i,kk:longint;
 
begin
if k = n then begin
	put();
	exit;
end;
kk := n - k;
for i := kk downto p do begin
	inc(cc);
	a[cc] := i;
	go(k + i, i);
	dec(cc);
end;
end;
 
begin
reset(input, 'input.txt');
rewrite(output, 'output.txt');
read(n);
go(0, 1);
end.